<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
    {include file="Public/header"/}
    <title>编辑分组</title>
</head>
<body>
<article class="page-container">
    <form action="" method="post" class="form form-horizontal" id="form-edit">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户组：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="{$data['title']}"
                       placeholder="用户组名称" name="title">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">描述：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <textarea class="textarea" name="description" id="" cols="30" rows="10">{$data['description']}</textarea>
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <button type="submit" class="btn btn-success radius" id="admin-role-save"><i class="icon-ok"></i> 确定</button>
            </div>
        </div>
    </form>
</article>
{include file="Public/footer" /}
<!--请在下方写此页面业务相关的脚本-->
{include file="Public/expand-js" /}
<script type="text/javascript">
    $("#form-edit").validate({
        rules: {
            title: {
                required: true,
            }
        },
        //description
        onkeyup: false,
        focusCleanup: true,
        success: "valid",
        submitHandler:function(){
            var title        = $("input[name='title']").val();
            var description = $("textarea[name='description']").val();
            $.ajax({
                type: "POST",
                url: '',
                data: {
                    title       : title,
                    description : description
                },
                error: function(request) {
                    layer.msg('操作错误，请重试',{icon: 1,time:1500})
                },
                success: function(data) {
                    if(data.code)
                    {
                        layer.msg(data.msg,{icon: 1,time:1500})
                        setTimeout(function(){
                            window.parent.location.reload();
                        }, 1800);
                    }else{
                        layer.msg(data.msg,{icon: 5,time:1500})
                    }
                }
            });
        }
    });
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>